/**
 * Created by changshuiwang on 2016/7/25.
 */
function ajaxFileUpload()
{
    var doing = '';
    $("#loading")
        .ajaxStart(function(){
            $(this).show();
            document.getElementById('logo').innerHTML="图片上传中……";
        })
        .ajaxComplete(function(){
            $(this).hide();
            document.getElementById('logo').innerHTML= doing;
        });
    $.ajaxFileUpload
    (
        {
            url:'/site/upload',
            secureuri:false,
            fileElementId:'file',
            dataType: 'json',
            data:{name:'logan', id:'id'},
            success: function(data)
            {
                console.log(data);
                data=JSON.parse(data);
                if(data.status=='success'){
                    //alert(data.status);
                    $("#upd_pics").empty();
                    $("#upd_pics").html(
                        "<p><img src='"+ data.msg +"' width='100px'> <input type='checkbox' checked name='AddForm[photo]' value="+ data.msg +" /> "+data.msg
                        +"</p>");
                }else{
                    alert(data.msg);
                }
/*                data=data.replace('<pre>','');
                data=data.replace('</pre>','');
                var info=data.split('|');*/
                //上传多张图片的代码
                /*						var c = $("#upd_pics").html();
                 $("#upd_pics").html(c +
                 "<p><img src='"+ info[1] +"' width='100px'> <input type='checkbox' checked name='pics[]' value="+ info[1] +" /> "+info[1]
                 +"</p>");
                 var pic_url=info[1];*/
                /*$.ajax({
                 url: "uploadPic_ajax.php",
                 type: "POST",
                 data:{url:pic_url},
                 dataType: "json",
                 error: function(){},
                 success: function(data){ }
                 });*/
            },
            error: function (data, status, e)
            {
                alert(e);
            }
        }
    )
    return false;
}
function check_file() {
    $("#spanMsg").html('');
}
function exportClick() {
    $("#spanMsg").html('');
    if ($("#file").val() == '') {
        alert('请先选择要导入的文件');
        return false;
    }
}
$(function(){
});